package JavaSe;

import sun.rmi.runtime.Log;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

/**
 * @author VX5
 * @Title: MJC
 * @ProjectName DataStructure
 * @Description: TODO
 * @date ${DAT}9:38
 */
public class 泛型测试 {
    public static void main(String[] args) {
        List<String> stringList = new ArrayList<>();
        List<Integer> integerArrayList = new ArrayList<>();

        Class classString = stringList.getClass();
        Class classIntegerArrayList = stringList.getClass();

        if (classIntegerArrayList.equals(classIntegerArrayList)){
            System.out.println("类型相同");
        }
    }

    class Generic<T>{
        private T key;

        public Generic(T key) {
            this.key = key;
        }

        public T getKey() {
            return key;
        }

        public <T> T showKeyName(Generic<T> contatiner){
            System.out.println(contatiner.getKey());
            T test = contatiner.getKey();
            return test;
        }
    }

    interface Generator<T>{
        public T next();
    }
}
